
import React, {Component} from 'react';
import {
  View,
  StyleSheet,
  Text,
  ListView,
  TouchableHighlight,
  RefreshControl,
  TouchableOpacity,
} from 'react-native';

import Config from '../../config';
import WH_Constants from './WH_Constants'
import BasePage from '../common/BasePage';
import TImage from '../../components/TImage';
import SizeUtils from '../../common/SizeUtils';
import Constants from '../../common/Constants';
import CommonStyles from '../../common/CommonStyles';


const BUTTON_ARR =[
  {key:'user', name:"用户发帖指南",
    url:'http://43.241.76.189:8082/admin/app/UserPostGuide.html',
    icon:require("../../../resource/images/workhard/user_zhinan.jpg")},
  {key:"jiguan", name:"机关部门使用指南",
    url:'http://43.241.76.189:8082/admin/app/SectionGuide.html',
    icon:require("../../../resource/images/workhard/jiguan_zhinan.jpg")},
  {key:"zonghe", name:"综合科使用指南",
    url:'http://43.241.76.189:8082/admin/app/Guide.html',
    icon:require("../../../resource/images/workhard/zonghe_zhinan.jpg")},
];

export default class WH_ZhinanPage extends BasePage {

	render() {
    return (
      <View style={{flex:1,paddingTop:Config.paddingTop,backgroundColor:'#fff'}}>
        <View style={{flex:1,alignItems: 'center',marginTop:SizeUtils.translateDesignHeightToCode(40),}}>
          {BUTTON_ARR.map((item,index)=> this._getPageButton(item) )}
        </View>
      	{this._renderNavigationBar()}
      </View>
    )
  }

  _getPageButton(typeData) {
    return (
      <TouchableOpacity
        key={typeData.key}
        onPress = {() => {
          this.gotoPage(Config.pages.post_common_web, {url:typeData.url,title:typeData.name});
        }} style={{
          justifyContent: 'center',alignItems: 'center',
          marginTop:SizeUtils.translateDesignHeightToCode(40),
        }}>
          <TImage source={typeData.icon} style={{width:SizeUtils.getWindowSize().width,
              height:200}} />
          <Text style={[CommonStyles.secondaryText,
            {fontSize:SizeUtils.translateFontSizeToCode(32),
              marginTop:SizeUtils.translateDesignHeightToCode(20),
              backgroundColor:"#00000000", borderWidth:0,}]}>{typeData.name}
          </Text>
      </TouchableOpacity>
    )
  }

}